VERSION 5.00
Object = "{00025600-0000-0000-C000-000000000046}#5.2#0"; "crystl32.ocx"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form frmSell 
   BackColor       =   &H8000000D&
   Caption         =   "Report for Sell"
   ClientHeight    =   2895
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6210
   ClipControls    =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   2895
   ScaleWidth      =   6210
   StartUpPosition =   2  'CenterScreen
   Begin Crystal.CrystalReport Cre 
      Left            =   4680
      Top             =   0
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   348160
      PrintFileLinesPerPage=   60
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   2760
      Top             =   120
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H8000000D&
      Caption         =   "Local"
      ForeColor       =   &H8000000E&
      Height          =   1815
      Left            =   240
      TabIndex        =   2
      Top             =   360
      Width           =   5655
      Begin VB.CheckBox Check 
         BackColor       =   &H8000000D&
         Caption         =   "Detail"
         ForeColor       =   &H8000000E&
         Height          =   255
         Left            =   600
         TabIndex        =   12
         Top             =   1080
         Width           =   975
      End
      Begin VB.OptionButton Option3 
         BackColor       =   &H8000000D&
         Caption         =   "By Foreign"
         ForeColor       =   &H8000000E&
         Height          =   375
         Left            =   4080
         TabIndex        =   11
         Top             =   240
         Width           =   1215
      End
      Begin VB.TextBox Tdate 
         Height          =   285
         Left            =   3960
         TabIndex        =   8
         Top             =   1440
         Width           =   1335
      End
      Begin VB.TextBox Fdate 
         Height          =   285
         Left            =   1440
         TabIndex        =   7
         Top             =   1440
         Width           =   1215
      End
      Begin VB.TextBox CustNo 
         Height          =   195
         Left            =   2280
         TabIndex        =   6
         Top             =   120
         Visible         =   0   'False
         Width           =   495
      End
      Begin MSDataListLib.DataCombo Dcust 
         Height          =   360
         Left            =   600
         TabIndex        =   5
         Top             =   720
         Width           =   4695
         _ExtentX        =   8281
         _ExtentY        =   635
         _Version        =   393216
         ListField       =   "CMNME"
         BoundColumn     =   "CMCNO"
         Text            =   ""
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "VNI-Times"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin VB.OptionButton Option2 
         BackColor       =   &H8000000D&
         Caption         =   "By All Customer"
         ForeColor       =   &H8000000E&
         Height          =   375
         Left            =   2400
         TabIndex        =   4
         Top             =   240
         Width           =   1575
      End
      Begin VB.OptionButton Option1 
         BackColor       =   &H8000000D&
         Caption         =   "By One Customes"
         ForeColor       =   &H8000000E&
         Height          =   375
         Left            =   600
         TabIndex        =   3
         Top             =   240
         Width           =   1695
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "To date"
         ForeColor       =   &H8000000E&
         Height          =   195
         Left            =   2880
         TabIndex        =   10
         Top             =   1440
         Width           =   555
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "From date"
         ForeColor       =   &H8000000E&
         Height          =   195
         Left            =   600
         TabIndex        =   9
         Top             =   1440
         Width           =   705
      End
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "&Close"
      Height          =   375
      Left            =   4200
      TabIndex        =   1
      Top             =   2400
      Width           =   1095
   End
   Begin VB.CommandButton cmdPrint 
      Caption         =   "&Print"
      Height          =   375
      Left            =   960
      TabIndex        =   0
      Top             =   2400
      Width           =   1095
   End
End
Attribute VB_Name = "frmSell"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Check_Click()
Fdate.SetFocus
End Sub

Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdPrint_Click()
If Option1.value = True Then
    If (Dcust.Text = "") Or (Fdate.Text = "") Or (Tdate.Text = "") Then
        MsgBox "No value in Text box! Please enter value", vbCritical, "Warning"
        Exit Sub
    Else
        Cre.ReportFileName = DDAN & "\Sell_item.rpt"
        Cre.RetrieveStoredProcParams
        Cre.StoredProcParam(0) = Format$(Fdate.Text, "mm/dd/yyyy")
        Cre.StoredProcParam(1) = Format$(Tdate.Text, "mm/dd/yyyy")
        Cre.StoredProcParam(2) = custno.Text
        Cre.Destination = crptToWindow
        Cre.Action = 1
    End If
End If
If Option2.value = True Then
    If (Fdate.Text = "") Or (Tdate.Text = "") Then
        MsgBox "No value in Text box! Please enter value", vbCritical, "Warning"
        Exit Sub
    Else
        If Check.value = vbChecked Then
            Cre.ReportFileName = DDAN & "\ReportSellforallcustdetail.rpt"
            Cre.RetrieveStoredProcParams
            Cre.StoredProcParam(0) = Format$(Fdate.Text, "mm/dd/yyyy")
            Cre.StoredProcParam(1) = Format$(Tdate.Text, "mm/dd/yyyy")
            Cre.Destination = crptToWindow
            Cre.Action = 1
        Else
            Cre.ReportFileName = DDAN & "\ReportSellforLocalCustomer.rpt"
            Cre.RetrieveStoredProcParams
            Cre.StoredProcParam(0) = Format$(Fdate.Text, "mm/dd/yyyy")
            Cre.StoredProcParam(1) = Format$(Tdate.Text, "mm/dd/yyyy")
            Cre.Destination = crptToWindow
            Cre.Action = 1
        End If
    End If
End If
If Option3.value = True Then
    If (Fdate.Text = "") Or (Tdate.Text = "") Then
        MsgBox "No value in Text box! Please enter value", vbCritical, "Warning"
        Exit Sub
    Else
        Cre.ReportFileName = DDAN & "\ReportSellforForeignCustomer.rpt"
        Cre.RetrieveStoredProcParams
        Cre.StoredProcParam(0) = Format$(Fdate.Text, "mm/dd/yyyy")
        Cre.StoredProcParam(1) = Format$(Tdate.Text, "mm/dd/yyyy")
        Cre.Destination = crptToWindow
        Cre.Action = 1
    End If
End If
End Sub

Private Sub Dcust_Change()
    If Dcust.Text <> "" Then
        custno.Text = Dcust.BoundText
        Fdate.SetFocus
    End If
End Sub


Private Sub FD_Click()
custno.Text = ""
Dcust.Text = ""
Fdate.Text = ""
Tdate.Text = ""
End Sub

Private Sub Fdate_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        Tdate.SetFocus
    End If
End Sub

Private Sub Form_Load()
Adodc1.ConnectionString = ConnectString
Adodc1.CommandTimeout = 10
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select CMCNO,CMCNO +'  :  '+ CMNME as CMNME FROM RCM"
Set Dcust.RowSource = Adodc1
Option1.value = False
Option2.value = False
Option3.value = False
Check.Visible = False
Check.value = 0
End Sub
Private Sub Option1_Click()
Option1.value = True
Option2.value = False
Option3.value = False
Dcust.Enabled = True
Dcust.Text = ""
Check.Visible = False
End Sub
Private Sub Option2_Click()
Dcust.Enabled = False
custno.Text = ""
Dcust.Text = ""
Fdate.SetFocus
Option1.value = False
Option2.value = True
Option3.value = False
Check.Visible = True
End Sub


Private Sub Option3_Click()
Dcust.Enabled = False
custno.Text = ""
Dcust.Text = ""
Dcust.Enabled = False
Fdate.SetFocus
Option1.value = False
Option2.value = False
Option3.value = True
Check.Visible = False
End Sub

Private Sub Tdate_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        cmdPrint.SetFocus
    End If
End Sub
